<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取鼠标位置</title>
  <style>
    * {
      margin: 0px;
      padding: 0px;
    }
  </style>
  <script>
<!-- 通过event对象   -->
    function  f1(){
      console.log("鼠标所在的x轴坐标:" + event.clientX);
      console.log("鼠标所在的y轴坐标:" + event.clientY);
    }
  </script>
</head>
<body>
<div style="width: 200px;height: 100px;background-color: red;" onmouseover="f1()"></div>
</body>
</html>